// 用户
import api from '@/plugins/axiosInstance'
import config from '@/config'

console.log("api",api)

export async function emailLogin(email, code) {
	const resp = await api.post('/auth/oauth/token?client_id='+config.CLIENT_ID+'&grant_type=email&email=' + email +
		'&code=' + code + '&client_secret='+config.CLIENT_SECRET);
	return resp.data.data
}



export async function logout() {
	const resp = await api.delete('/auth/oauth/logout');
	return resp.data.code === 200;
}

//获取用户信息
export async function getUserInfo() {
	const resp = await api.get('/api/members/me');
	return resp.data.data;
}

export async function sendEmailCode(email) {
	const resp = await api.get('/auth/oauth/code?email='+email);
	return resp.data.code === 200
}